home *** CD-ROM | disk | FTP | other *** search
/ Games of Daze / Infomagic - Games of Daze (Summer 1995) (Disc 1 of 2).iso / djgpp / clients / xfd / fontgrip.h < prev    next >
C/C++ Source or Header  |  1994-08-12  |  2KB  |  54 lines

  1. #ifndef _FontGridP_h_
  2. #define _FontGridP_h_
  3.  
  4. #include "fontgrid.h"
  5.  
  6. typedef struct _FontGridClassPart { int dummy; } FontGridClassPart;
  7.  
  8. typedef struct _FontGridClassRec {
  9.     CoreClassPart    core_class;
  10.     SimpleClassPart    simple_class;
  11.     FontGridClassPart    grid_class;
  12. } FontGridClassRec;
  13. extern FontGridClassRec fontgridClassRec;
  14.  
  15. typedef struct _FontGridPart {
  16.     XFontStruct *    text_font;        /* font to display */
  17.     int            cell_cols, cell_rows;  /* number of cells */
  18.     int            cell_width, cell_height;  /* size of cell */
  19.     Pixel        foreground_pixel;    /* color of text */
  20.     Pixel        box_pixel;    /* for box_chars */
  21.     Boolean        center_chars;    /* center characters in grid */
  22.     Boolean        box_chars;    /* put box around logical width */
  23.     XtCallbackList    callbacks;    /* for notifying caller */
  24.     int            internal_pad;    /* extra padding inside grid */
  25.     Dimension        start_char;    /* first character of grid */
  26.     int            grid_width;    /* width of grid lines */
  27.     /* private data */
  28.     GC            text_gc;    /* printing text */
  29.     GC            box_gc;        /* for box_chars */
  30.     int            xoff, yoff;    /* extra offsets within grid */
  31. } FontGridPart;
  32.  
  33. typedef struct _FontGridRec {
  34.     CorePart        core;
  35.     SimplePart        simple;
  36.     FontGridPart    fontgrid;
  37. } FontGridRec;
  38.  
  39. #define DefaultCellWidth(fgw) (((fgw)->fontgrid.text_font->max_bounds.width) \
  40.                    + ((fgw)->fontgrid.internal_pad * 2))
  41. #define DefaultCellHeight(fgw) ((fgw)->fontgrid.text_font->ascent + \
  42.                 (fgw)->fontgrid.text_font->descent + \
  43.                 ((fgw)->fontgrid.internal_pad * 2))
  44.  
  45.  
  46. #define CellWidth(fgw) (((int)(fgw)->core.width - (fgw)->fontgrid.grid_width) \
  47.             / (fgw)->fontgrid.cell_cols \
  48.             - (fgw)->fontgrid.grid_width)
  49. #define CellHeight(fgw) (((int)(fgw)->core.height - (fgw)->fontgrid.grid_width)\
  50.              / (fgw)->fontgrid.cell_rows \
  51.              - (fgw)->fontgrid.grid_width)
  52.  
  53. #endif /* !_FontGridP_h_ */
  54.